using BJ.AuthEntity;
using BJ.AuthEntity.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Syspetro.Aliyun;
using Syspetro.Core;
using Syspetro.DepFreeSql;
using Syspetro.Deploy;
using Syspetro.DepRedis;

namespace BJ.Auth
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

        }
        public IConfiguration Configuration { get; }
        public void ConfigureServices(IServiceCollection services)
        {
            services.InitApp(Configuration, "auth");
            services.AddSyspetro(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Namespace);
            services.AddRedis();
            services.AddFreeSql<SyspetroAuthContext>(null,typeof(User),typeof(UserAuth));
            services.AddTransient<IEmailService, EmailService>();
            services.AddTransient<ISMSService, SMSService>();
        }
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseSyspetro(env);
        }
    }
}
